package frontend.parser.syntaxtree;

import frontend.lexer.TKType;
import frontend.parser.syntaxtree.symbol.NonTerminalSymbol;
import frontend.parser.syntaxtree.symbol.TerminalSymbol;

import java.util.function.Consumer;

public class UnaryExpNodeForFuncCall extends UnaryExpNode {
    public String ident;
    public FuncRParamsNode params;
    public int identLineNum = -1;

    @Override
    public void walk(Consumer<TerminalSymbol> terConsumer, Consumer<NonTerminalSymbol> nonTerConsumer) {
        terConsumer.accept(new TerminalSymbol(TKType.IDENFR, ident));
        terConsumer.accept(new TerminalSymbol(TKType.LPARENT));

        if (params != null) {
            params.walk(terConsumer, nonTerConsumer);
        }

        terConsumer.accept(new TerminalSymbol(TKType.RPARENT));

        nonTerConsumer.accept(new NonTerminalSymbol(this));
    }
}
